package org.michaelrenaud.pathfinder.client.core.app;

import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.ViewImpl;

public class AppView extends ViewImpl implements AppPresenter.MyView {

	public interface Binder extends UiBinder<Widget, AppView> {}

	@UiField HTMLPanel pnlSheet;
	private final Widget widget;

	@Inject
	public AppView(final Binder binder) {
		widget = binder.createAndBindUi(this);
	}
	
	@Override
	public void setInSlot(Object slot, Widget content) {
		if(slot == AppPresenter.TYPE_RevealContent)
			pnlSheet.clear();
			if(content != null)
				pnlSheet.add(content, pnlSheet.getElement());
		else
			super.setInSlot(slot, content);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}
}
